from app.db.base import Base, engine
from app.core.logging_config import get_logger

logger = get_logger(__name__)

def init_db():
    """初始化数据库表"""
    try:
        logger.info("Creating database tables...")
        Base.metadata.create_all(bind=engine)
        logger.info("Database initialization completed")
    except Exception as e:
        logger.exception("Database initialization failed")
        raise

if __name__ == "__main__":
    init_db() 